<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /* 
        map映射数组:
          - 一定会返回一个和原数组长度一致的新数组
          - 新数组的每一个值,都是遍历数组回调函数每次执行的返回值
      
      */
      const arr = [1, 2, 3, 4];

      const result = arr.map((item, index) => {
        return item + 1;
      });

      console.log(result);//[2, 3, 4, 5]
    </script>
  </body>
</html>
